Add heltec_rcc6 board#11041
Conversation
📝 WalkthroughWalkthroughAdds Heltec RCC6 ESP32-C6 board support with build metadata, pin and feature definitions, hardware identification, NV3001B display handling, and runtime screen detection. ChangesHeltec RCC6 support
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant PlatformIO
participant TFTDisplay
participant Arduino_NV3001B
participant NodeDB
participant NV3001B
PlatformIO->>TFTDisplay: Build with HELTEC_RCC6
TFTDisplay->>Arduino_NV3001B: Initialize over software SPI
TFTDisplay->>Arduino_NV3001B: Render and control display
NodeDB->>NV3001B: Read display identifier
NV3001B-->>NodeDB: Return identifier
NodeDB->>NodeDB: Set screen availability
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/graphics/TFTDisplay.cpp (1)
1626-1635: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winReturn failure when the NV3001B cannot initialize.
A failed
begin()is only logged; execution continues through rotation, drawing, and ultimately returnstrue, falsely reporting a connected display.Proposed fix
- if (beginStatus) - LOG_DEBUG("TFT Success!"); - else + if (!beginStatus) { LOG_ERROR("TFT Fail!"); + return false; + } + LOG_DEBUG("TFT Success!");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/graphics/TFTDisplay.cpp` around lines 1626 - 1635, Update the TFT initialization flow around beginStatus so a failed tft->begin() immediately returns false from the enclosing display initialization function after logging the failure. Preserve the existing success log and subsequent rotation/drawing logic only for successful initialization, ensuring the function cannot report true when the display fails to initialize.
🧹 Nitpick comments (1)
src/mesh/NodeDB.cpp (1)
254-254: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename
get_nv3001b_idtogetNv3001bId.As per coding guidelines, “Use
camelCasefor functions and members.”Proposed rename
-uint32_t get_nv3001b_id(uint8_t cs, uint8_t sck, uint8_t mosi, uint8_t dc, uint8_t rst, uint8_t en, uint8_t bl) +uint32_t getNv3001bId(uint8_t cs, uint8_t sck, uint8_t mosi, uint8_t dc, uint8_t rst, uint8_t en, uint8_t bl) ... - uint32_t nv3001b_id = get_nv3001b_id(TFT_CS, TFT_SCL, TFT_SDA, TFT_RS, TFT_RST, TFT_EN, TFT_BL); + uint32_t nv3001b_id = getNv3001bId(TFT_CS, TFT_SCL, TFT_SDA, TFT_RS, TFT_RST, TFT_EN, TFT_BL);Also applies to: 1140-1140
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/mesh/NodeDB.cpp` at line 254, Rename the function get_nv3001b_id to getNv3001bId and update every declaration, definition, and call site, including the additional occurrence, while preserving its signature and behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/mesh/NodeDB.cpp`:
- Around line 1139-1144: Update the HELTEC_RCC6 display initialization flow so
the false value assigned to hasScreen after the NV3001B ID check prevents
TFTDisplay::connect() from starting when no panel is detected. Thread hasScreen
into the TFT startup path or gate the module connection, while preserving normal
initialization when the expected display is present.
---
Outside diff comments:
In `@src/graphics/TFTDisplay.cpp`:
- Around line 1626-1635: Update the TFT initialization flow around beginStatus
so a failed tft->begin() immediately returns false from the enclosing display
initialization function after logging the failure. Preserve the existing success
log and subsequent rotation/drawing logic only for successful initialization,
ensuring the function cannot report true when the display fails to initialize.
---
Nitpick comments:
In `@src/mesh/NodeDB.cpp`:
- Line 254: Rename the function get_nv3001b_id to getNv3001bId and update every
declaration, definition, and call site, including the additional occurrence,
while preserving its signature and behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0debf068-32e4-4aca-8aab-623f5e419b07
📒 Files selected for processing (7)
boards/heltec-rcc6.jsonsrc/graphics/TFTDisplay.cppsrc/mesh/NodeDB.cppsrc/platform/esp32/architecture.hvariants/esp32c6/heltec_rcc6/pins_arduino.hvariants/esp32c6/heltec_rcc6/platformio.inivariants/esp32c6/heltec_rcc6/variant.h
| #ifdef HELTEC_RCC6 | ||
| uint32_t nv3001b_id = get_nv3001b_id(TFT_CS, TFT_SCL, TFT_SDA, TFT_RS, TFT_RST, TFT_EN, TFT_BL); | ||
| if (nv3001b_id != NV3001B_EXPECTED_ID) { | ||
| hasScreen = false; | ||
| } | ||
| #endif // HELTEC_RCC6 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Propagate the absent-display state into TFT startup. hasScreen only affects Bluetooth pairing mode here; RCC6 still builds with HAS_SCREEN, so TFTDisplay::connect() can still initialize a panel that was just detected as absent and powered off. Thread that state into display startup or gate the module connection.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/mesh/NodeDB.cpp` around lines 1139 - 1144, Update the HELTEC_RCC6 display
initialization flow so the false value assigned to hasScreen after the NV3001B
ID check prevents TFTDisplay::connect() from starting when no panel is detected.
Thread hasScreen into the TFT startup path or gate the module connection, while
preserving normal initialization when the expected display is present.
⚡ Try this PR in the Web FlasherNote Building this pull request… the flash button, badges and supported-board |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/graphics/TFTDisplay.cpp (2)
1654-1658: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove redundant rotation configuration.
The explicit branch for
HELTEC_RCC6sets the rotation to 3, which is exactly what the fallback#elsebranch does. This specific#elifcan be removed to reduce code duplication without changing the behavior.♻️ Proposed fix
-#elif defined(HELTEC_RCC6) - tft->setRotation(3); `#else` tft->setRotation(3); // Orient horizontal and wide underneath the silkscreen name label🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/graphics/TFTDisplay.cpp` around lines 1654 - 1658, Remove the redundant HELTEC_RCC6 conditional branch in the display rotation configuration, leaving it to use the existing fallback setRotation(3) behavior. Preserve the other preprocessor branches and the fallback comment.
1616-1617: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winConsider using hardware SPI instead of software SPI for better display performance.
Using
Arduino_SWSPIfor the display backend relies on software bit-banging, which can result in noticeably slow screen redraws and high CPU overhead. If the display pins on the ESP32-C6 can be mapped to a hardware SPI peripheral (e.g., usingArduino_ESP32SPIwith an appropriate host likeFSPIorSPI2_HOST), it is highly recommended to use it to improve UI responsiveness.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/graphics/TFTDisplay.cpp` around lines 1616 - 1617, Replace the Arduino_SWSPI bus construction in the TFT initialization with an Arduino_ESP32SPI hardware-SPI backend, using the appropriate ESP32-C6 host and existing TFT pin assignments. Keep the Arduino_NV3001B initialization and display configuration unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/graphics/TFTDisplay.cpp`:
- Around line 1654-1658: Remove the redundant HELTEC_RCC6 conditional branch in
the display rotation configuration, leaving it to use the existing fallback
setRotation(3) behavior. Preserve the other preprocessor branches and the
fallback comment.
- Around line 1616-1617: Replace the Arduino_SWSPI bus construction in the TFT
initialization with an Arduino_ESP32SPI hardware-SPI backend, using the
appropriate ESP32-C6 host and existing TFT pin assignments. Keep the
Arduino_NV3001B initialization and display configuration unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ead359f9-ef9a-4b4a-b5b8-6adc2ae99afe
📒 Files selected for processing (3)
src/graphics/TFTDisplay.cppsrc/mesh/NodeDB.cppvariants/esp32c6/heltec_rcc6/platformio.ini
🚧 Files skipped from review as they are similar to previous changes (2)
- variants/esp32c6/heltec_rcc6/platformio.ini
- src/mesh/NodeDB.cpp
Summary
Add support for the Heltec RCC6 ESP32-C6 board.
This includes the new PlatformIO board/environment, ESP32-C6 variant and pin mapping, SX1262 LoRa support, battery monitoring, USB CDC, and NV3001B TFT display support.
Changes
heltec_rcc6ESP32-C6 variant and Arduino pin mapping.TFTDisplaysupport for the 128×220 NV3001B display.RDDIDandRDIDregisters.Attestations